#ifndef WIDGET_HEADER_BUTTONS_H
#define WIDGET_HEADER_BUTTONS_H

#include <QFrame>
#include <QLabel>
#include <QDebug>
#include <QMouseEvent>

namespace Ui {
class widget_header_buttons;
}

class widget_header_buttons : public QFrame
{
    Q_OBJECT
    
public:
    explicit widget_header_buttons(QWidget *parent = 0);
    ~widget_header_buttons();

public slots:
    void on_back_button_clicked();
    void on_logout_button_clicked();
    void on_student_list_view_clicked();
    void on_test_list_view_clicked();

private slots:
    void on_messageLabel_clicked();
    void on_alarmLabel_clicked();

private:
    Ui::widget_header_buttons *ui;
};

class QLabelClicker : public QLabel
{
    Q_OBJECT

public:
    QLabelClicker(QWidget * parent):
        QLabel(parent)
    {

    }

signals:
    void clicked(QMouseEvent * e);

private:
    bool mousedown;
    void mouseReleaseEvent(QMouseEvent *e){
        if (mousedown == true){
            emit(clicked(e));
        }
        mousedown = false;
    }

    void mousePressEvent(QMouseEvent *){
        qDebug("MOUSEPRESSED");
        this->mousedown = true;
    }

    void mouseMoveEvent(QMouseEvent *e){
        qDebug() << "MOUSEMOVE x: " << e->x() <<" y: " << e->y();
        QSize s = this->size();
        if (e->y() < 0 || e->y() > s.height() || e->x() < 0 || e->x() > s.width()){
            mousedown = false;
        }
    }
};

#endif // WIDGET_HEADER_BUTTONS_H
